<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>欢迎注册</title>
<style>
span{font-size:14px; color:#444; }
</style>
</head>
<body  bgcolor="#eaeaec" background="bg.png" style=" background-repeat:no-repeat ;
background-size:40%; 
background-attachment: fixed;">
<?php
require 'config.php';
if(isset($_GET['sub']))
{
	$name=$_GET['name'];
	$repwd=$_GET['repwd'];
	$tel1=$_GET['tel1'];
	$tel2=$_GET['tel2'];
	$class=$_GET['class'];
	$user=$_GET['user'];
	$pwd=$_GET['pwd'];
	$mail=$_GET['mail'];
	$time=date('Y-m-d H:i:s');
	if($pwd!=$repwd)
	{
		echo '<span>两次密码不一致，请返回重新填写,4秒后返回</span><script>setTimeout(\'location.href="register.php"\',4000)</script><br/>';
		echo '<span>密码为：</span><font size=6 color="red">'.$pwd.'</font></span><br/>';
		echo '<span>确认密码为：</span><font size=6 color="red">'.$repwd.'</font><br/>';
	}
	else
	{
	$sql="insert into user 
	(id,user,pwd,times,mail,newname,time,name,tel1,tel2,class)values
	(null,'$user','$pwd',0,'$mail','666666.gif','$time','$name','$tel1','$tel2','$class')";
	$query=mysqli_query($conn,$sql);
	if($query)
	{
		echo '<font size=6 color="#444">注册成功 <br/>您的账号为:</font><font size=6 color="red">'.$user.'</font><br/>
		<font size=6 color="#444"> 密码为:</font><font size=6 color="red">'.$pwd.'<br/></font>   
		<font size=6 color="#444">7秒后返回登录页</font><script>setTimeout(\'location.href="login.php"\',7000)</script>';
	}
	else
		echo '注册失败，原因可能是账号已存在<script>setTimeout(\'location.href="register.php"\',1698)</script>';
	}
}
else
{
?>	
<form autocomplete="on">
<table>
	<tr>
	<th colspan="3" bgcolor="#eaeaec"><br/></th>
	</tr>
	<tr>
	<th colspan="3" bgcolor="#eaeaec"><br/></th>
	</tr>
</table>
<table border=0 bgcolor="white" align="center"  width="400" style="border-radius:20px;" >
	<center>
	<h2>
	<font face="楷体" color="#ff3300"></font>
	</h2>
	<center>
	
	<th colspan="3"><font face="楷体" size="4">新用户注册</font></th>
	</tr>
	
	<tr>
		<td>用户名:</td>
		<td>
			<div class="list">
				<input TYPE="text" NAME="user" placeholder="请输入用户名" style="border-radius:5px; height:25px;"required ><br/>
		
			</div>
		</td>
	</tr>
	<tr>
		<td>姓名</td>
		<td><div class="list">
				<INPUT TYPE="text" NAME="name" placeholder="请输入您的真实姓名" required style="border-radius:5px; height:25px;">
			</div>
		</td>
	</tr>
	<tr>
		<td>密&nbsp;码:</td>
		<td><div class="list">
				<INPUT TYPE="password" NAME="pwd" placeholder="请输入密码" required style="border-radius:5px; height:25px;">
			</div>
		</td>
	</tr>
	<tr>
		<td>确认密码:</td>
		<td><div class="list">
				<INPUT TYPE="password" NAME="repwd" placeholder="请确认密码" required style="border-radius:5px; height:25px;">
			</div>
		</td>
	</tr>
	<tr>
		<td>手机号</td>
		<td><div class="list">
				<INPUT TYPE="text" NAME="tel1" placeholder="请输入手机号码" required style="border-radius:5px; height:25px;">
			</div>
		</td>
	</tr>
	<tr>
		<td>备用手机号</td>
		<td><div class="list">
				<INPUT TYPE="text" NAME="tel2" placeholder="请输入备用手机号码" required style="border-radius:5px; height:25px;">
			</div>
		</td>
	</tr>
	<tr>
		<td>验证邮箱</td>
		<td><div class="list">
				<INPUT TYPE="email" name="mail" placeholder="很重要，不要乱写" autocomplete="off" style="border-radius:5px; height:25px;">
			</div>
		</td>
	</tr>
	<tr>
		<td>班级</td>
		<td><div class="list">
				<INPUT TYPE="text" name="class" placeholder="例如格式：交校17前端班" autocomplete="off" style="border-radius:5px; height:25px;">
			</div>
		</td>
	</tr>
	<tr>
	<th>
		<a href="login.php" style="color:red" onclick="return confirm('确定返回吗?')">返回上一页</a>
	</th>
	<th><input type="image" name="sub" value="注册" src="register.png"></th>
	</tr>
<table>

<br><br>
<table style="color:#fff;border-radius:10px;" bgcolor="#b6d6d5" align="center" border="0">
<tr>
	<th colspan="2">注意事项</th>
</tr>
<tr>
	<td>1：</td>
	<td>注册时姓名请务必填写真实姓名</td>
</tr>
<tr>
	<td>2：</td>
	<td>填写手机号务必真实，且至少继续使用5年及以上</td>
</tr>
<tr>
	<td>3：</td>
	<td>邮箱仅在忘记密码时验证时使用，并不发送邮件</td>
</tr>
</table>
<br>
<table width="43%" style="color:#fff;border-radius:10px;" bgcolor="#d7c2b5" align="center" border="0">
<tr>
	<th>本页面仅周六 周天09:00-16:00开放注册</th>
</tr>
</table>
<?php }?>
</form>
</body>
</html>
